package MultiMediaPlayer;

import MultiMediaPlayer.Interface.PlatForm;
import MultiMediaPlayer.Media.AVI;
import MultiMediaPlayer.Media.Adapter.AviAdapter;
import MultiMediaPlayer.Media.Facade.MediaFacade;
import MultiMediaPlayer.Media.MP3;
import MultiMediaPlayer.Media.MP4;
import MultiMediaPlayer.Media.Media;
import MultiMediaPlayer.Media.Playlist.PlayList;
import MultiMediaPlayer.Media.Proxy.MediaProxy;
import MultiMediaPlayer.Media.decorator.EffectDecorator;
import MultiMediaPlayer.Media.decorator.SpeedDecorator;
import MultiMediaPlayer.Media.decorator.SubtitleDecorator;
import MultiMediaPlayer.PlatForm.LinuxPlatform;
import MultiMediaPlayer.PlatForm.WindowsPlatform;

public class MediaPlayerApplication {
    public static void main(String[] args) {
        PlatForm windowsPlatform = new WindowsPlatform();
        PlatForm linuxPlatform = new LinuxPlatform();

        Media mp3 = new MP3(windowsPlatform);
        Media decoratedMp3 = new SubtitleDecorator(new SpeedDecorator(mp3, 1.5));
        //字幕+速度的MP3

        MP4 mp4 = new MP4(linuxPlatform);
        Media decoratedMp4 = new EffectDecorator(mp4);
        //音效增强的MP4

        AviAdapter avi2mp4 = new AviAdapter(windowsPlatform);
        //AVI转MP4

        PlayList playList = new PlayList();
        playList.addMedia(decoratedMp3);
        playList.addMedia(decoratedMp4);
        playList.addMedia(avi2mp4);

        MediaProxy proxy = new MediaProxy(playList, "admin");
        proxy.play();
        //以上是播放列表的代理播放

        System.out.println(" ");

        //TODO:有点不懂为什么decode会被调用两次
        MediaFacade mediaFacade = new MediaFacade();
        mediaFacade.playMedia(decoratedMp3, "windows");
        mediaFacade.playMedia(decoratedMp4, "linux");
        //以上是外观模式的播放,由于没有使用代理模式，所以无日志记录
    }
}
